/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gw.reportbuilder.table;

/**
 *
 * @author Sostenes
 */
public class Table {
    
    private String name;
    private String label;
    
    
    public Table(String name) {

        this.name = name;
        this.label = name;

        validate();

    }

    public Table(String name, String label) {

        this.name = name;
        this.label = label == null || label.trim().isEmpty() ? name : label;

        validate();
    }

    private void validate() {

        if (name == null || name.trim().isEmpty()) {
            throw new IllegalArgumentException("name cannot be null or empty string");
        }
    }

    public String getName() {

        return name;
    }

    public String getLabel() {

        return label;
    }

    @Override
    public String toString() {

        return name + " as \"" + label + "\"";
    }
    
}
